{% extends "personal_center/base.html" %}
{% load state_display %}
{% block page_link %}
    <link rel="stylesheet" href="../../static/technological/css/style.css">
    <link rel="stylesheet" href="../../static/public_file/css/PersonnelChooser.css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }
        .add_background {
            background: #A9A9A9;
        }
        tr td {
            height: 35px;outline: none;
        }
        th {
            text-align: center;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .button_for_control {
            width: 90px;height: 30px;border: 1px solid #99D3F5;background: #D0EEFF;border-radius: 4px;letter-spacing: 0;line-height: 30px;color: #089bab;margin: 5px 0;
        }
        .shade1 {
            position: fixed;top: 0;left: 0;right: 0;bottom: 0;background-color: rgba(36, 36, 36, 0.5);display: none;z-index: 10000;
        }
        .file {
            position: relative;display: inline-block;background: #D0EEFF;border: 1px solid #99D3F5;border-radius: 4px;padding: 4px 12px;overflow: hidden;color: #1E88C7;text-decoration: none;text-indent: 0;line-height: 20px;
        }
        .file input {
            position: absolute;font-size: 100px;right: 0;top: 0;opacity: 0;
        }
        .file:hover {
            background: #AADFFD;border-color: #78C3F3;color: #004974;text-decoration: none;
        }
        .a_tag_cla{
            display: block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;height: 30px;line-height: 30px;padding-left: 1%;
        }
        #ThreeNavigation div {
            padding-left: 2%;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 100%;height: 40px;background: white;border-bottom: #A9A9A9 solid 0.5px;line-height: 40px;padding-left: 1%;color: black;">
        <div id="DW_tag" class="tab_top top_tag" onclick="change_mind('DW')">
            申请详情
        </div>
        <div id="LH_tag" class="tab_top" onclick="change_mind('LH')">
            附件
        </div>
         <div id="lct_tag" class="tab_top" onclick="change_mind('lct')">
            流程图
        </div>

        <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
            <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                    style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                操作
            </button>
        </div>

        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
             style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 0.9%; top: 80px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
            <button onclick="print_topics()" class="button_for_control">
                打印
            </button>

            {% if is_audit == 'true' %}
                <button id="approve" onclick="online_tag()" class="button_for_control">
                    审批
                </button>
            {% endif %}

            {% if is_edit == 'true' %}
                <button id="submit_data" onclick="submit_data()" class="button_for_control">
                    提交
                </button>
            {% endif %}

            {% if is_stop == 'true' %}
                <button onclick="do_revoke()" class="button_for_control">
                    终止
                </button>
            {% endif %}
        </div>

        <div style="width: 110px;float: right;text-align: center;margin-right: 6px;height: 40px;">
            <button style="line-height: 27px;border-radius: 3px;border: #1E90FF solid 0.5px;width: 100px;height: 30px;margin-top: 5px;background: #1E90FF;color: white;" onclick="javascript:history.back(-1)">
                返回
            </button>
        </div>
    </div>

    <div id="DW" style="width: 100%;height: 95%;background: white;overflow: auto;">
        <div id="menu_from" style="width: 100%;height: 100%;color: #2C3E50;display: inline-block;vertical-align: top;padding-top: 20px;padding-bottom: 100px;">
            <div style="width: 100%;height: auto;display: inline-block;vertical-align: center;">
                <div style="width: 100%;">
                    <table style="width: 90%;margin-left: 5%;">
                        <tr style="width: 100%;">
                            <td colspan="6" style="width: 100%;height: 40px;padding-left: 0.5%;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;"><h3 id="form_name">京山市人民医院职工出国（境）审批表</h3></td>
                        </tr>
                        <tr style="width: 100%;">
                            <td colspan="6" style="width: 100%;height: 35px;background: #F5F5F5;padding-left: 0.5%;line-height: 40px;border-right: #cfcfcf solid 1px;border-left: #cfcfcf solid 1px;color: #00a0e9;">申请详情</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">姓名</p>
                            </td>
                            <td id="applicat" style="width: 20%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;">{{ obj.apply_user.real_name }}</td>
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">工号</p>
                            </td>
                            <td id="job_number" style="width: 20%;border: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">{{ obj.apply_user.job_number }}</td>
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">科室</p>
                            </td>
                            <td id="company" style="width: 30%;border: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">{{ obj.company.name }}</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">进院时间</p>
                            </td>
                            <td id="entry_time" style="width: 20%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.entry_time }}</td>
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">入党时间</p>
                            </td>
                            <td id="join_party_time" style="width: 20%;border: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.join_party_time }}</td>
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">所在职务</p>
                            </td>
                            <td style="width: 30%;border: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;border-top: none;">
                                {% if is_edit == 'false' %}
                                    {% if obj.position == '1' %}院领导{% elif obj.position == '2' %}科主任{% elif obj.position == '3' %}副主任{% elif obj.position == '4' %}护士长{% else %}其他{% endif %}
                                {% else %}
                                    <select name="" id="position" style="width: 100%;height: 100%;border: none;outline: none;">
                                        <option value="0">请选择所在职务</option>
                                        <option value="1" {% if obj.position == '1' %}selected{% endif %}>院领导</option>
                                        <option value="2" {% if obj.position == '2' %}selected{% endif %}>科主任</option>
                                        <option value="3" {% if obj.position == '3' %}selected{% endif %}>副主任</option>
                                        <option value="4" {% if obj.position == '4' %}selected{% endif %}>护士长</option>
                                        <option value="5" {% if obj.position == '5' %}selected{% endif %}>其他</option>
                                    </select>
                                {% endif %}
                            </td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 50px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">前往<br>国家/地区</p>
                            </td>
                            <td id="onwards_country" colspan="3" style="width: 50%;height: 50px;line-height: 50px;padding-left: 1%;border: #cfcfcf solid 0.5px;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.onwards_country }}</td>
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 50px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">人员类别</p>
                            </td>
                            <td style="width: 30%;height: 50px;line-height: 50px;border: #cfcfcf solid 0.5px;border-top: none;">
                                {% if is_edit == 'false' %}
                                    {% if obj.position_identity == '1' %}行管{% elif obj.position_identity == '2' %}医技/临床{% else %}护理{% endif %}
                                {% else %}
                                    <select name="" id="position_identity" style="width: 100%;height: 100%;border: none;outline: none;">
                                        <option value="0">请选择人员类别</option>
                                        <option value="1" {% if obj.position_identity == '1' %}selected{% endif %}>行管</option>
                                        <option value="2" {% if obj.position_identity == '2' %}selected{% endif %}>医技/临床</option>
                                        <option value="3" {% if obj.position_identity == '3' %}selected{% endif %}>护理</option>
                                    </select>
                                {% endif %}
                            </td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td rowspan="2" style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">国外<br>通讯处</p>
                            </td>
                            <td style="width: 20%;height: 35px;line-height: 35px;border: #cfcfcf solid 0.5px;border-top: none;text-align: center;">
                                中文
                            </td>
                            <td id="mailing_address_ch" colspan="4" style="width: 70%;border: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.mailing_address_ch }}</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 20%;height: 35px;line-height: 35px;border: #cfcfcf solid 0.5px;border-top: none;text-align: center;padding-right: 0.5%;">
                                外文
                            </td>
                            <td id="mailing_address_en" colspan="4" style="width: 70%;border: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.mailing_address_en }}</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 50px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">申请理由<br>及期限</p>
                            </td>
                            <td id="application_reason" colspan="5" style="width: 20%;height: 50px;line-height: 50px;padding-left: 1%;border: #cfcfcf solid 0.5px;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.application_reason }}</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 150px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">国内直系<br>亲属及主<br>要社会关<br>系情况</p>
                            </td>
                            <td id="social_relations_ch" colspan="5" style="width: 20%;height: 150px;padding-left: 1%;border: #cfcfcf solid 0.5px;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.social_relations_ch }}</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 150px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">国外直系<br>亲属及主<br>要社会关<br>系情况</p>
                            </td>
                            <td id="social_relations_en" colspan="5" style="width: 20%;height: 150px;padding-left: 1%;border: #cfcfcf solid 0.5px;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.social_relations_en }}</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 150px;border-top: none;padding-right: 0.5%;">
                                <p style="width: 90px;float: right;text-align-last: justify;">是否有《职工出国（境）管理办法》中规定的不得批准出国（境）的情况</p>
                            </td>
                            <td id="restrictive_conditions" colspan="5" style="width: 20%;height: 150px;padding-left: 1%;border: #cfcfcf solid 0.5px;border-top: none;" contenteditable="{{ is_edit }}">{{ obj.restrictive_conditions }}</td>
                        </tr>
                    </table>
                    <table style="width: 90%;margin-left: 5%;">
                        <tr>
                            <td colspan="6" style="height: 40px;padding-left: 0.5%;line-height: 40px;background: #F5F5F5;border: #cfcfcf solid 0.5px;border-top: none;padding-right: 1%;color: #00a0e9;">
                                审批详情
                            </td>
                        </tr>
                        {% if 'one' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;padding-right: 0.5%;border-top: none;">
                                    <p style="width: 130px;float: right;text-align-last: justify;">科室负责人意见</p>
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'one' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt="" style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'two' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;padding-right: 0.5%;border-top: none;">
                                    <p style="width: 130px;float: right;text-align-last: justify;">监察室审核意见</p>
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'two' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt=""
                                                                 style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'three' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;padding-right: 0.5%;border-top: none;">
                                    <p style="width: 130px;float: right;text-align-last: justify;">分管部门意见</p>
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'three' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt=""
                                                                 style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'four' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;padding-right: 0.5%;border-top: none;">
                                    <p style="width: 130px;float: right;text-align-last: justify;">分管领导意见</p>
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'four' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt=""
                                                                 style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'five' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;padding-right: 0.5%;border-top: none;">
                                    <p style="width: 130px;float: right;text-align-last: justify;">人事科审核意见</p>
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'five' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt=""
                                                                 style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                    {% if is_edit == 'true' %}
                <div style="width: 90%;margin-left: 5%;">
                    <div style="width: 100%;height: 40px;line-height: 40px;background-color: #F5F5F5;color: #1E90FF;padding-left: 1%;border: #cccccc solid 1px;border-top: none;border-bottom: none;padding-right: 1%;">
                        上传附件
                        <a href="javascript:;" class="file" style="vertical-align: top;margin-top: 5px;float: right;">
                            上传文件
                            <input type="file" name="party_main_body" id="party_main_body"
                                   onchange="upload_accessory('file1', 'party_main', 'party_main_body')">
                        </a>
                    </div>
                    <table style="width: 100%;">
                        <thead>
                        <tr>
                            <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">序号</td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                文件名称
                            </td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                文件大小
                            </td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                上传时间
                            </td>
                            <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">
                                上传人员
                            </td>
                            <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;">操作
                            </td>
                        </tr>
                        </thead>
                        <tbody style="overflow: auto;" id="party_main">
                            {% for record in file_list %}
                                <tr>
                                    <td style="width: 5%;border: #cccccc solid 1px;text-align: center;">{{ forloop.counter }}</td>
                                    <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.file_name }}</td>
                                    <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.file_size }}</td>
                                    <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.upload_time }}</td>
                                    <td style="width: 20%;border: #cccccc solid 1px;border-left: none;text-align: center;">{{ record.uploader }}</td>
                                    <td style="width: 15%;border: #cccccc solid 1px;border-left: none;text-align: center;"><a target='_blank' href="{{ record.file_path }}">查看</a> | <a style="color: red;" href='#' onclick='RemoveTr(this, "party_main", {{ record.id }})' >删除</a></td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            {% endif %}
                </div>
            </div>
        </div>
    </div>

    <div id="LH" style="width: 100%;height: 95%;background: white;display: none;">
        <div style="display: inline-block;width: 20%;vertical-align: top;height: 99%">
            <div style="width: 100%;height: 40px;background: #c8cbcf;padding-left: 2%;line-height: 40px;color: #0c6fd9;">
                附件
            </div>
            <div id="yt_zhengwen" style="width: 100%;">
                {% for item in file_list %}
                    <div><a href="#" class="a_tag_cla" title="{{ item.file_name }}" onclick="chage_yulan(this, '{{ item.file_path }}')">{{ item.file_name }}</a></div>
                {% endfor %}
            </div>

        </div>
        <div style="display: inline-block;width: 78%;vertical-align: top;height: 99%;text-align: center;" id="fujian">
            {% if 'jpg' in file_path or 'JPG' in file_path or 'JPEG' in file_path or 'jpeg' in file_path or 'PNG' in file_path or 'png' in file_path %}
                <img src="{{ file_path }}" alt="" style="width: 800px;height: 100%;">
            {% else %}
                <embed id="embed_file" src="{{ file_path }}" type="application/pdf" style="width: 100%;height: 100%;">
            {% endif %}
        </div>
    </div>

    <div id="lct" style="width: 100%;height: 95%;background: white;display: none;">
        <div style="width: 100%;height: 40%;text-align: center;margin: 20% auto;">
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    ({{ obj.apply_user.real_name }})<br>
                    发起人
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    start
                </div>
            </div>

            {% if 'one' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'one' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                科室负责人
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'two' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'two' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                监察室
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'three' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'three' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                分管部门
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'four' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'four' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                分管领导
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'five' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'five' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                人事科
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            <div style="display: inline-block;border: #0d8ddb solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    <span style="visibility: hidden;">({{ obj.apply_user.real_name }})</span><br>
                    结束
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    ending
                </div>
            </div>
        </div>
    </div>

    <div id="appave-model" class="shade1">
        <div id="examine-model" style="width: 700px;background: white;left: 50%;top: 50%;position: absolute;transform: translate(-50%, -50%);">
            <div id="appave-title" style="width: 100%;height: 40px;border-bottom: #cfcfcf solid 1px;font-size: 14px;cursor: move;">
                <div style="width: 40%;height: 40px;line-height: 40px;text-align: left;padding-left: 1%;letter-spacing: 2px;float: left;">
                    审批
                </div>
                <div style="width: 59%;height: 40px;letter-spacing: 2px;float: left;">
                    <div onclick="close_models()" style="width: 40px;height: 40px;text-align: center;line-height: 40px;cursor: pointer;float: right;">
                        <i class="iconfont icon-quchu"></i>
                    </div>
                </div>
            </div>

            <div style="width: 100%;font-size: 14px;background: #E8E8E8;padding-top: 1%;">
                <div style="width: 98%;height: 150px;margin-left: 1%;background: white;padding-top: 1%;padding-left: 1%;border-radius: 3px;padding-right: 1%;">
                    <div style="width: 100%;height: 35px;line-height: 35px;border-bottom: #E8E8E8 solid 1px;padding-left: 1%;">
                        基本信息
                    </div>
                    <div style="width: 100%;height: 125px;padding-left: 1%;">
                        <div style="width: 100%;height: 50px;">
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">前往国家/地区：</span>{{ obj.onwards_country }}
                            </div>
                            <div style="width: 49%;height: 50px;float: right;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">进院时间：</span>{{ obj.entry_time }}
                            </div>
                        </div>

                        <div style="width: 100%;height: 50px;">
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">申请理由及期限：</span>{{ obj.application_reason }}
                            </div>
                            <div style="width: 49%;height: 50px;float: left;padding-left: 1%;color: #B5B5B5;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;line-height: 50px;">
                                <span style="color: #9C9C9C;">入党时间：</span>{{ obj.join_party_time }}
                            </div>
                        </div>
                    </div>
                </div>

                <div style="width: 98%;margin-left: 1%;background: white;padding-top: 1%;padding-left: 1%;border-radius: 3px;margin-top: 1%;padding-right: 1%;padding-bottom: 20px;">
                    <div style="width: 100%;height: 35px;line-height: 35px;border-bottom: #E8E8E8 solid 1px;padding-left: 1%;">
                        意见
                    </div>
                    <div style="width: 100%;">
                        <textarea id="opinion_detail" placeholder="请输入审批意见" style="width: 96%;height: 100px;margin-left: 2%;margin-top: 1%;border: #cfcfcf solid 1px;outline: none;font-size: 14px;" ></textarea>
                    </div>
                </div>

                <div style="width: 100%;height: 40px;background: white;margin-top: 1%;text-align: right;padding-right: 2%;">
                    <button onclick="do_audit('audit')" style="letter-spacing: 3px;width: 100px;height: 30px;margin-top: 5px;border-radius: 1px;border: #00a0e9 solid 1px;text-align: center;background: #00a0e9;color: white;">同意</button>
                    <button onclick="do_audit('draft')" style="letter-spacing: 3px;width: 100px;height: 30px;margin-top: 5px;border-radius: 1px;border: #00a0e9 solid 1px;text-align: center;background: #00a0e9;color: white;margin-left: 15px;">退回修改</button>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" src="../../static/public_file/other/jquery.js"></script>
    <script src="../../static/administrative/layDate-v5.0.9/laydate/laydate.js"></script> <!-- 改成你的路径 -->
    <script language="javascript" src="../../static/personal_center/js/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript">
        window.onload = function () {
            document.getElementById("sponsor").className = "add_class";
            document.getElementById("personage").className = "add-nav-active";
        };

        function print_topics() {
            $('#menu_from').jqprint({
                debug: false,
                importCSS: true,
                printContainer: true,
                operaSupport: false
            });
        }

        let appave_title = document.querySelector("#appave-title");
        let examine_model = document.querySelector("#examine-model");

        appave_title.addEventListener("mousedown", function (e) {
            let x = e.pageX - examine_model.offsetLeft;
            let y = e.pageY - examine_model.offsetTop;
            document.addEventListener("mousemove", move);

            function move(e) {
                examine_model.style.left = e.pageX - x + 'px';
                examine_model.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function online_tag() {
            document.getElementById("appave-model").style.display = "table-row";
        }

        function close_models() {
            document.getElementById("appave-model").style.display = "none";
        }

        function change_mind(ele_id) {
            if (ele_id === "DW") {
                document.getElementById("DW").style.display = "inline-block";
                document.getElementById("DW_tag").className = "tab_top top_tag";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
            }else if (ele_id === "LH") {
                document.getElementById("LH").style.display = "inline-block";
                document.getElementById("LH_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
            }else {
                document.getElementById("lct").style.display = "inline-block";
                document.getElementById("lct_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
            }
        }

        // 提交审批
        function do_audit(approve) {
            var audit_note = document.getElementById("opinion_detail").value;
            if (approve === "draft") {
                if (!audit_note) {
                    alert("不同意请填写理由！");
                    return false
                }
            }
            var form = new FormData();
            form.append('id', '{{ obj.id }}');
            form.append('state', approve);
            form.append('audit_note', audit_note);
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/new-flow-logic/employees_abroad_detail.html");
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("审批成功");
                            window.location.href='/personal-center/process_management.html?type=我的待办&folw_type=差旅审批&folw=职工出国(境)审批&page=1&page_size=20&wd=';
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function submit_data() {
            var form = new FormData();
            var entry_time = document.getElementById('entry_time').innerText;
            var join_party_time = document.getElementById('join_party_time').innerText;
            var position = document.getElementById('position').value;
            var onwards_country = document.getElementById('onwards_country').innerText;
            var position_identity = document.getElementById('position_identity').value;
            var mailing_address_ch = document.getElementById("mailing_address_ch").innerText;
            var mailing_address_en = document.getElementById("mailing_address_en").innerText;
            var application_reason = document.getElementById("application_reason").innerText;
            var social_relations_ch = document.getElementById('social_relations_ch').innerText;
            var social_relations_en = document.getElementById('social_relations_en').innerText;
            var restrictive_conditions = document.getElementById('restrictive_conditions').innerText;

            if (!entry_time) {
                alert('进院时间不能为空！')
                return false
            }
            if (position === '0') {
                alert('请选择所在职务！')
                return false
            }
            if (!onwards_country) {
                alert('前往国家/地区不能为空！')
                return false
            }
            if (position_identity === '0') {
                alert('请选择人员类别！')
                return false
            }
            if (!mailing_address_ch) {
                alert('国外通讯处中文不能为空！')
                return false
            }
            if (!mailing_address_en) {
                alert('国外通讯处英文不能为空！')
                return false
            }
            if (!application_reason) {
                alert('申请理由及期限不能为空！')
                return false
            }
            if (!social_relations_ch) {
                alert('国内直系亲属及主要社会关系情况不能为空！')
                return false
            }
            if (!social_relations_en) {
                alert('国外直系亲属及主要社会关系情况不能为空！')
                return false
            }
            if (!restrictive_conditions) {
                alert('是否有《职工出国（境）管理办法》中规定的不得批准出国（境）的情况不能为空！')
                return false
            }
            document.getElementById("loading").style.display = "inline-block";

            form.append("entry_time", entry_time);
            form.append('join_party_time', join_party_time)
            form.append('position', position)
            form.append('onwards_country', onwards_country)
            form.append('position_identity', position_identity)
            form.append('mailing_address_ch', mailing_address_ch)
            form.append('mailing_address_en', mailing_address_en)
            form.append('application_reason', application_reason)
            form.append('social_relations_ch', social_relations_ch)
            form.append('social_relations_en', social_relations_en)
            form.append('restrictive_conditions', restrictive_conditions)
            form.append('id', {{ obj.id }})
            var xhr = new XMLHttpRequest();
            xhr.open('post', "/new-flow-logic/employees_abroad_index.html", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("修改成功");
                            window.location = "/new-flow-logic/employees_abroad_list.html";
                        } else {
                            alert(JsonDate['message']);
                            document.getElementById("loading").style.display = "none";
                        }
                    }
                }
             };
        }

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function do_revoke() {
            var id = '{{ obj.id }}';
            var r = confirm('是否确认终止流程？')
            if (r === true) {
                var xhr = new XMLHttpRequest();
                xhr.open('post', "/new-flow-logic/employees_abroad_operation", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send("operate_type=stop&id=" + id)
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            console.log(JsonDate);
                            alert(JsonDate['message'])
                            window.location.href = "/new-flow-logic/employees_abroad_list.html"
                        }
                    }
                };
            }
        }

        // 上传附件
        function upload_accessory(file_type, tbody_id, accessory_type) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            form.append(file_type, files);
            form.append('number', '{{ obj.fj_number }}')
            form.append('source', 'jdqd')
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        creat_table(JsonDate, tbody_id)
                    }
                }
            };
        }

        // 创建附件列表
        function creat_table(JsonData, tbody_id) {
            var t_table = document.getElementById(tbody_id);
            var local_host = window.location.host;
            if (Array.isArray(JsonData["pdf_path"])) {
                for (var i = 0; i < JsonData["pdf_path"].length; i++) {
                    var tr = document.createElement("tr");var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                    td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                    td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                    td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                    td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                    td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                    td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"][i]["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["pdf_path"][i]["id"] + "\")'>删除</a>";
                    td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                    tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);
                    t_table.appendChild(tr);
                }
                if (JsonData["pdf_path"].length > 1) {
                    document.getElementById("del_adjunct").style.display = 'block';
                }
            } else {
                tr = document.createElement("tr");td1 = document.createElement("td");td2 = document.createElement("td");td3 = document.createElement("td");td4 = document.createElement("td");td5 = document.createElement("td");td6 = document.createElement("td");
                td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["id"] + "\")'>删除</a>";
                td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);t_table.appendChild(tr);
            }
        }

        function RemoveTr(_this, tbody_id, wj_id) {
            var table = document.getElementById(tbody_id);
            var trNode = $(_this).parent().parent();
            trNode.remove();

            for (var i=0; i<table.children.length; i++){
                table.children[i].children[0].innerHTML=i+1;
            }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id="+String(wj_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }

        function chage_yulan(this_, file_path) {
            var fujian = document.getElementById("fujian");
            var file_index = file_path.lastIndexOf(".")
            var ext = file_path.substring(file_index+1)
            var arr=['jpg', 'JPG', "JPEG", "jpeg", "PNG", "png"];
            var ext_index=arr.indexOf(ext);
            if (ext_index === -1){
                fujian.innerHTML = '<embed id="embed_file" src="'+file_path+'" type="" style="width: 100%;height: 100%;">'
            }else {
                fujian.innerHTML = '<img src="' + file_path + '" alt="application/pdf" style="width: 800px;height: 100%;">'
            }

            var a_tag_list = document.getElementsByClassName("a_tag_cla");
            for (var i = 0;i<a_tag_list.length; i++){
                a_tag_list[i].style.background='';
            }
            this_.style.background='#cfcfcf';
        }
    </script>
{% endblock %}



